/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaz;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author pedro
 */
public class PJuego extends javax.swing.JPanel {
    private Image doblebuffer ;//= this.jPanel2.createImage(800,460);
    private boolean pausa=false;

    public boolean getPausa() {
        return pausa;
    }

    public void setPausa(boolean pausa) {
        this.pausa = pausa;
    }
    
    
    public void paint(Graphics g){
        update(g);
    }
    public void update(Graphics g){
         super.paint(g);
        g.drawImage(doblebuffer, 0, 0, this);
       
    }
    
    public JLabel getjLabel1() {
        return jLabel1;
    }

    public void setjLabel1(String jLabel1) {
        this.jLabel1.setText(jLabel1);
    }

    public JLabel getjLabel2() {
        return jLabel2;
    }

    public void setjLabel2(String jLabel2) {
        this.jLabel2.setText(jLabel2);
    }

    public JLabel getjLabel3() {
        return jLabel3;
    }

    public void setjLabel3(int jLabel3) {
        this.jLabel3.setText(String.valueOf(jLabel3));
    }

    /**
     * Creates new form PJuego
     */
    public PJuego() {
        initComponents();
    }

    public JPanel getjPanel2() {
        return jPanel2;
    }
    
    public JButton getbtPause() {
        return btPause;
    }

    public Image getDoblebuffer() {
        return doblebuffer;
    }

    public void setDoblebuffer(Image doblebuffer) {
        this.doblebuffer = doblebuffer;
    }
    
    public void GoalPlayer1(){
        int score = Integer.valueOf(jLabel4.getText());
        jLabel4.setText(String.valueOf(++score));
    }
    public void GoalPlayer2(){
        int score = Integer.valueOf(jLabel8.getText());
        jLabel8.setText(String.valueOf(++score));
    }
    
    public void resetScores(){
        jLabel4.setText(String.valueOf(0));
        jLabel3.setText(String.valueOf(5));
        jLabel8.setText(String.valueOf(0));
    }
    
    
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        btPause = new javax.swing.JButton();

        setLayout(null);

        jPanel1.setLayout(null);

        jLabel1.setText("player 1");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(36, 6, 90, 16);

        jLabel2.setText("player 2");
        jPanel1.add(jLabel2);
        jLabel2.setBounds(598, 6, 50, 16);

        jLabel3.setText("5");
        jPanel1.add(jLabel3);
        jLabel3.setBounds(700, 30, 21, 16);

        jLabel4.setText("0");
        jPanel1.add(jLabel4);
        jLabel4.setBounds(132, 6, 21, 16);

        jLabel5.setText("VS");
        jPanel1.add(jLabel5);
        jLabel5.setBounds(374, 6, 15, 16);

        jLabel6.setText("Vidas");
        jPanel1.add(jLabel6);
        jLabel6.setBounds(630, 30, 34, 16);

        jLabel8.setText("0");
        jPanel1.add(jLabel8);
        jLabel8.setBounds(700, 6, 21, 16);

        add(jPanel1);
        jPanel1.setBounds(6, 472, 788, 60);

        jPanel2.setLayout(null);
        add(jPanel2);
        jPanel2.setBounds(0, 0, 800, 470);

        btPause.setText("Pausa");
        add(btPause);
        btPause.setBounds(350, 540, 80, 29);
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btPause;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration//GEN-END:variables
}
